﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IndexPayload>" %>
<%@ Import Namespace="ActivateYourGlutes.Payloads.Body"%>
<asp:Content ID="bodyTitle" ContentPlaceHolderID="TitleContent" runat="server">
Your Measurements
</asp:Content>
<asp:Content ID="bodyContent" ContentPlaceHolderID="MainContent" runat="server">
    <div id="subheader">
        <h2>Charted Progress</h2>
        <div>
            <%= Html.ActionLink("New Measurement", MVC.Body.Create()) %>
            <%= Html.ActionLink("View as Grid", MVC.Body.Grid()) %>
        </div>
    </div>
    <!-- To embed in existing html copy the code below -->
    <script type="text/javascript" src="<%= Url.Content("~/Content/Visifire2.js")%>"></script>
    <div id="VisifireChart" style="text-align:center">
    <script language="javascript" type="text/javascript">
        var chartXmlString = ''
+ '<vc:Chart xmlns:vc="clr-namespace:Visifire.Charts;assembly=SLVisifire.Charts" Width="840" Height="480" BorderThickness="0" Theme="Theme1" Watermark="False" >'
    + '<vc:Chart.Titles>'
        + '<vc:Title Text="Your Progress" Enabled="False" />'
    + '</vc:Chart.Titles>'
    + '<vc:Chart.AxesX>'
        + '<vc:Axis Title="Measurements" Interval="7" IntervalType="Days" ValueFormatString="d MMM yyyy" />'
    + '</vc:Chart.AxesX>'
    + '<vc:Chart.AxesY>'
        + '<vc:Axis Title="<%= ViewData.Model.PrimarySeriesTitle %>" StartFromZero="False" AxisType="Primary" />'
        + '<vc:Axis Title="<%= ViewData.Model.SecondarySeriesTitle %>" StartFromZero="False" AxisType="Secondary" />'
    + '</vc:Chart.AxesY>'
    + '<vc:Chart.Series>'
<% foreach(var series in ViewData.Model.Series) { %>
        + '<%= series %>'
<% } %>
    + '</vc:Chart.Series>'
+ '</vc:Chart>';
        var vChart = new Visifire2("<%= Url.Content("~/Content/SL.Visifire.Charts.xap")%>" , 840 , 480 );
        vChart.setDataXml(chartXmlString);
        vChart.render("VisifireChart");
    </script>
    </div>
<%
   using (Html.BeginForm())
   {
%>
    <%= Html.AntiForgeryToken() %>
    <% Html.RenderPartial(MVC.Shared.Views.HorizontalMeasurementTypes, ViewData.Model.HorizontalMeasurementTypesPayload); %>
<%
   }
%>
</asp:Content>
